package com.lz.util;

import java.sql.Connection;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.sql.DataSource;

public class ConnMgr {

    public static Connection getConnection(){
        
        
        Connection conn=null;
        try {
      
        
            Context initContext = new InitialContext();
            Context envContext  = (Context)initContext.lookup("java:/comp/env");
            
        DataSource ds = (DataSource) envContext.lookup(PropertyReader.getConfigProperty("datasource"));
        
      
        conn=ds.getConnection();
      
        } 
        catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return conn;
    }
    

    
}
